package exception;

import java.util.HashMap;
import java.util.Map;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {

	@ExceptionHandler(RuntimeException.class)
	@ResponseBody
	public Map<String, Object> exeptionHandler(Exception e) {
		Map<String, Object> error = new HashMap<>();
		error.put("code", "500");
		error.put("msg", "error");
		e.printStackTrace();
		return error;
	}
	
}	
